package pa4.interfaces;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.HashMap;

public interface Peer<V> extends Remote{
	
	public final String SERVICENAME = "pa4.Peer";

	public int getNumberOfStoredValues() throws RemoteException;
	public int getNumberOfReceivedMessages() throws RemoteException;
	public int getNumberOfNodes() throws RemoteException;
	public int getNumberOfLeafNodes() throws RemoteException;
	
	public void connect(Peer<V> peer) throws RemoteException;
	
	public Node<V> createNode(int id, boolean isLeaf, int level, boolean init) throws RemoteException;
	public void messageReceived() throws RemoteException;
	public void valueStored() throws RemoteException;
	public void valueRemoved() throws RemoteException;
	public String getName() throws RemoteException;
	
	public Node<V> replicateNode(int id, boolean isLeaf) throws RemoteException;
	public void repairNodes(String faultyAddress) throws RemoteException;
	public void repairNode(Node<V> node, String faultyAddress) throws RemoteException;
	
	public void removeNode(int id) throws RemoteException;
	
	public Node<V> getNodeWithId(int id) throws RemoteException;
	
	public void heartBeat(Peer<V> otherPeer) throws RemoteException;
	
	public void pushRegisteredPeerList(ArrayList<Peer<V>> registeredPeers) throws RemoteException;


}
